Skip to content

VCN: VC4 stand-pat, VC5 check ordering, PASS in TT#36

Closed
Copilot wants to merge 8 commits intomasterfrom
copilot/add-vcn-search-mode
Closed

VCN: VC4 stand-pat, VC5 check ordering, PASS in TT#36
Copilot wants to merge 8 commits intomasterfrom
copilot/add-vcn-search-mode

Conversation

Copy link

Copilot AI commented Mar 6, 2026

Three correctness fixes to the VCN search implementation covering stand-pat semantics in VC4 mode, VC5 quick-check ordering, and safe use of PASS as a TT best move.

VC4 stand-pat disabled in vcfsearch()

In VC4 mode the attacker must find a VCF sequence — returning static eval as "good enough" is wrong. vcfsearch() now initialises bestValue = mated_in(ss->ply + 2) when vcnAllowB4, bypassing stand-pat and delta-pruning entirely:

  • No VCF moves found → returns mated_in(ss->ply + 2) (correct)
  • VCF moves found → loop updates bestValue normally
  • Single unified if (PvNode && bestValue > alpha) alpha = bestValue; replaces the two duplicated alpha-update branches

VC5 quick check reordered

Vcn::vc5AttackerLoses() is now evaluated before the board-filled/max-ply draw check in both search() and vcfsearch(). A VC5 attacker with no A_FIVE should always return mated_in(ss->ply), never a draw score, even when the board is full.

PASS as TT best move

The hashtable already encodes Pos::PASS safely (move + 1 offset, see hashtable.cpp), so the previous filter bestMove == Pos::PASS ? Pos::NONE : bestMove in TT.store is reverted. Instead, the three call sites that reach board.cell(ttMove) — which asserts pos >= 0 and crashes for Pos::PASS — are individually guarded:

Site Fix
MovePicker MAIN constructor args.ttMove != Pos::PASS before board.cell() in DEFENDFIVE/DEFENDFOUR
MovePicker QVCF constructor Same guard in DEFENDFIVE/QVCF branches
HistoryTracker::updateTTMoveStats Early return for ttMove == Pos::PASS after isLegal check

updateBestmoveStats retains its existing bestMove != Pos::PASS guard unchanged.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits March 6, 2026 13:19
…tion

Co-authored-by: dhbloo <32353216+dhbloo@users.noreply.github.com>
Co-authored-by: dhbloo <32353216+dhbloo@users.noreply.github.com>
Copilot AI changed the title [WIP] Add new VCN search mode to Rapfi Add VCN (Victory by Continuous N-level Attack) search mode to alpha-beta searcher Mar 6, 2026
…quick checks

Co-authored-by: dhbloo <32353216+dhbloo@users.noreply.github.com>
Co-authored-by: dhbloo <32353216+dhbloo@users.noreply.github.com>
Copilot AI changed the title Add VCN (Victory by Continuous N-level Attack) search mode to alpha-beta searcher VCN search: fix TT key segregation in qvcfsearch, remove vcnAllowB4 params, merge PASS stages Mar 7, 2026
Co-authored-by: dhbloo <32353216+dhbloo@users.noreply.github.com>
Copilot AI changed the title VCN search: fix TT key segregation in qvcfsearch, remove vcnAllowB4 params, merge PASS stages VCN cleanup: namespace, options consolidation, vcnLevel derivation from parent, PASS/TT safety Mar 7, 2026
…/history fix

Co-authored-by: dhbloo <32353216+dhbloo@users.noreply.github.com>
Copilot AI changed the title VCN cleanup: namespace, options consolidation, vcnLevel derivation from parent, PASS/TT safety VCN: VC4 stand-pat, VC5 check ordering, PASS in TT Mar 7, 2026
@dhbloo dhbloo closed this Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants